import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ASUS
 * Date: 2022-07-30
 * Time: 10:53
 */
public class HomeWork {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int y = sc.nextInt();
        if(x > y){
            int tmp = x;
            x = y;
            y = tmp;
        }
        int a = x;
        int b = y;
        while((y % x) !=0 ){
            int tmp = y % x;
            y = x;
            x = tmp;
        }
        System.out.println("最大公约数为"+x);
        System.out.println("最小公倍数为"+(a*b/x));
    }

    public static void main3(String[] args) {
            Scanner sc = new Scanner(System.in);
            System.out.println("请输入要判断的数字：");
            int n = sc.nextInt();
            int i = 2;
            for(;i <= Math.sqrt(100);i++){
                if(n % i == 0){
                    System.out.println(n+"不是素数");
                    break;
                }
            }
            if(i >Math.sqrt(n)){
                System.out.println(n+"是素数");
            }
    }

    public static void main2(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入要判断的数字：");
        int n = sc.nextInt();
        int i = 0;

        for ( i = 2; i <= n/2 ; i++) {
            if(n % i == 0){
                System.out.println(n+"不是素数");
                break;
            }
        }
        if(i > n/2){
            System.out.println(n+"是素数");
        }
    }

    public static void main1(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入要判断的数字：");
        int n = sc.nextInt();
        int i = 0;

        for ( i = 2; i <= n-1 ; i++) {
            if(n % i == 0){
                System.out.println(n+"不是素数");
                break;
            }
        }
        if(i == n){
            System.out.println(n+"是素数");
        }
    }
}
